-
Notifications
You must be signed in to change notification settings - Fork 65
feat: add get_address_utxos
method
#134
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
feat: add get_address_utxos
method
#134
Conversation
`get_address_utxos` hits the `/address/{address}/utxo` endpoint and returns a `Vec<Utxo>`
Pull Request Test Coverage Report for Build 16817757977Details
💛 - Coveralls |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tACK 86d3d44
I've tested it with blocking client, and it worked just fine on both happy path, too many histories error and when it's unconfirmed.
assert_ne!(address_utxos_blocking.len(), 0); | ||
assert_ne!(address_utxos_async.len(), 0); | ||
assert_eq!(address_utxos_blocking, address_utxos_async); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could also add assertions for each field.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How so? Wouldn't deserialization to the Utxo
type fail if the values were incorrect?
/// Information about an UTXO's status: confirmation status, | ||
/// confirmation height, confirmation block hash and confirmation block time. | ||
#[derive(Debug, Copy, Clone, PartialEq, Eq, Deserialize)] | ||
pub struct UtxoStatus { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding docs here. Question: isn't this the same as the TxStatus
type?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, structurally they are the same. But I preferred to create another struct with a name that matches what it models. We could change the name of TxStatus
to something generic, but I don't think that's very elegant, since these types are ad-hoc to what the API returns.
Closes #133.
This PR adds the
get_address_utxos
method, which hits the/address/{addr}/utxo
endpoint, returning aVec<Utxo>
.Changelog
UtxoStatus
.Utxo
.get_address_utxos
for both blocking and async clients.